package it.infodea.tapestrydea.services.breadcrumb.bean;

import org.apache.tapestry5.Link;

public class BreadcrumbBean {

	private final Link link;

	private final String breadcrumbId;

	private String label;

	public BreadcrumbBean(Link link) {
		this(link, null);
	}

	public BreadcrumbBean(Link link, String breadcrumbId) {
		this.link = link;
		if (breadcrumbId == null) {
			breadcrumbId = link.toAbsoluteURI();
		}
		this.breadcrumbId = breadcrumbId;
	}

	public Link getLink() {
		return link;
	}

	public String getLabel() {
		return label;
	}

	public void setLabel(String label) {
		this.label = label;
	}

	public boolean equals(BreadcrumbBean obj) {
		return getId().equals(obj.getId());
	}

	public String getId() {
		return breadcrumbId;
	}

}
